package com.tianji.learning.controller.admin;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domian.query.ReplyPageQuery;
import com.tianji.learning.domian.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-03-21
 */
@RestController
@RequestMapping("/admin/replies")
@RequiredArgsConstructor
public class InteractionReplyAdminController {

    private final IInteractionReplyService replyService;


    @GetMapping("/page")
    @ApiOperation("分页查询回答或评论")
    public PageDTO<ReplyVO> queryReplyPage(ReplyPageQuery pageQuery) {
        return replyService.queryReplyPage(pageQuery,false);
    }

    /*隐藏或显示评论 Day5*/
    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("隐藏或显示评论")
    public void hiddenReply(
            @ApiParam(value = "问题id", example = "1") Long id,
            @ApiParam(value = "是否隐藏，true/false", example = "true") @PathVariable("hidden") Boolean hidden) {
        replyService.hiddenReply(id, hidden);
    }

    /*根据id查询回答或评论*/
    @GetMapping("/{id}")
    @ApiOperation("根据id查询回答或评论")
    public ReplyVO queryReplyById(@PathVariable("id") Long id) {
        return replyService.queryReplyById(id);
    }


}
